<?php
namespace Home\Controller;
use Think\Controller;
class ZxbjController extends Controller {
    public function index(){


        //区域
        $areaModel=M('area');
        $arrArea=$areaModel->select();
        $this->assign('arrArea',$arrArea);

        $this->display();
    }

    public function message(){

        $IndexController= new IndexController();
        $IndexController->message();

    }

    public function confirm()
    {
        $data['yzm'] = htmlspecialchars($_POST['yzm']);
        $data['mobile'] = htmlspecialchars($_POST['mobile']);
        $yzmModel = D('yzm');
        $yzmArr = $yzmModel->finded("number=" . $data['yzm'] . " and  mobile=" . $data['mobile']);

        //echo $yzmArr['mobile']; exit;
        if (!empty($yzmArr)) {
            $fastModel = D('fast');
            $list['mobile'] = htmlspecialchars($_POST['mobile']);
            $res = $fastModel->where(" mobile= " . $list['mobile'])->find();

            if (empty($res)) {
                $list['city'] = '上海';
                $list['name'] = htmlspecialchars($_POST['name']);
                $list['place'] = htmlspecialchars($_POST['place']);
                $list['status'] = htmlspecialchars($_POST['status']);
                $list['mobile'] = htmlspecialchars($_POST['mobile']);
                $list['area_id']= htmlspecialchars($_POST['area']);
                $list['plot']= htmlspecialchars($_POST['plot']);
                $list['create'] = time();
                $resu = $fastModel->add($list);
                if ($resu) {
                    echo 1;
                    exit;
                }
            }
            echo '您已获取报价';
            exit;
        }
        echo '验证码有误';
        exit;
    }

}